package com.gujiangbo;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;

@SpringBootApplication
@MapperScan(basePackages = {"com.gujiangbo.mapper"})
@PropertySources({@PropertySource("classpath:config/schedule.properties"), @PropertySource("classpath:config/data.yml")})
public class DataApplication extends SpringBootServletInitializer implements CommandLineRunner {

    private static final Log debugLog = LogFactory.getLog(DataApplication.class);

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(DataApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(DataApplication.class, args);
    }

    @Override
    public void run(String... args) {
        debugLog.info("========== data Application started info  ! ===============");
        debugLog.debug("========= data Application started debug ! ===============");
        debugLog.error("========= data Application started error ! ===============");
    }
}
